package org.mipt.infsec.steganography.components;

import java.awt.Component;
import java.awt.Graphics;
import java.awt.image.BufferedImage;

public class ImageComponent extends Component {


    public ImageComponent() {
        image = null;
    }

    public ImageComponent(BufferedImage image) {
        this.image = image;
    }

    @Override
    public void paint(Graphics g) {
        super.paint(g);
        g.drawImage(image, 0, 0, null);
    }

    public BufferedImage getImage() {
        return image;
    }

    public void setImage(BufferedImage image) {
        this.image = image;
        if (image != null) {
            setSize(image.getWidth(), image.getHeight());
        }
        repaint();
    }

    protected BufferedImage image;

}

